package com.hamll.search.controller;


import com.hamll.search.entity.ItemDoc;
import com.hamll.search.entity.RequestParams;
import com.hamll.search.service.ItemSearchSerivce;
import com.hamll.common.dto.PageDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class SearchController {

    @Autowired
    private ItemSearchSerivce itemSearchSerivce;


    // 关键词搜索
    @PostMapping("/search/list")
    public PageDTO<ItemDoc> search(@RequestBody RequestParams params) {
        return itemSearchSerivce.search(params);
    }



     // 获取过滤项
    @PostMapping("/search/filters")
    public Map<String, List<String>> filter(@RequestBody RequestParams params) {
        return itemSearchSerivce.filters(params);
    }
}
